<style lang="less" scoped>
    @border-color:#E3E8EA;//边框颜色
	@font-color:#686E71;//正常字体颜色
	@primary-color:#FE9333;//橘黄色默认颜色
    .templateInfo-top{
        width: 1200px;
        min-height: 224px;
        margin: 70px auto 10px;
        border: 1px solid #E3E8EA;
        background-color: #fff;
        padding: 32px 29px;
        ul{
            color: @font-color;
            overflow:hidden;
            margin-bottom: 20px;
            .title{
                font-size: 14px;
                font-weight: bold;            
            }
            .title+li{
                background-color: #F6FAF9;
                padding:0 13px;
                margin: 0 10px 0 14px;
                span{
                    display: none;
                }
            }
            li{
                float: left;
                line-height: 26px;
                margin-left: 20px;
                cursor: pointer;
                .span{
                    display:inline-block;
                    width: 15px;
                    height: 15px;
                    border-radius: 50%;
                    vertical-align: text-bottom;
                    margin-right: 4px;
                    border: 1px solid #CDD3D6;
                }
            }
            .onchoose{
                color:@primary-color;
            }
        }
    }
    .templateInfo-list{
        width: 1200px;
        min-height: 518px;
        margin: 0 auto 50px;
        border: 1px solid @border-color;
        background-color: #fff;
        .top{
            width: 100%;
            height: 50px;
            border-bottom: 1px solid  @border-color;
            position: relative;
            padding-left: 40px;            
            span{
                display: inline-block;
                font-size: 14px;
                color:@font-color;
                line-height: 48px;
                margin-right: 60px;
                cursor: pointer;
            }
            .onchoosebt{
                color: @primary-color;
                border-bottom: 2px solid @primary-color;
            }
            .search{
                width: 230px;
                height: 50px;
                position: absolute;
                top:0;
                right:10px;
                img{
                     position: absolute;
                     top: 7px;
                     right:10px;
                     width: 36px;
                     height: 36px;
                     cursor: pointer;
                     border-top-right-radius: 4px;
                     border-bottom-right-radius: 4px;
                }
            }
        }
        .not{
            text-align: center;
            overflow: hidden;
            img{
                margin-top: 120px;
                width: 120px;
                height: 120px;
            }
            p{
                text-align: center;
                font-size: 14px;
                color: @font-color;
            }
        }
        .list{
            width: 100%;
            // padding: 61px 0px 29px 36px;
            overflow: hidden;
            padding:18px 0 29px 36px;
            .popup{//搜索提示
                font-size: 14px;
                color: #686E71;
                line-height: 22px;
                margin-bottom: 21px;
            }
            .popup2{
                height: 12px;
            }
            .div{
                float: left;
                width: 200px;
                height: 365px;
                border: 1px solid @border-color;
                margin-right: 32px;
                margin-bottom: 32px;
                position: relative;
                .ewm{
                    position: absolute;
                    top:0;
                    left:0;
                    width: 100%;
                    height: 320px;
                    background-color: rgba(0,0,0,0.7);
                    display: none;
                    z-index: 10;
                    p{
                        text-align: center;
                        padding-top: 30px;
                        font-size: 14px;
                        color: #fff;
                        margin-bottom: 10px;
                    }
                    img{
                        width: 150px;
                        height: 150px;
                        margin-left: 25px;
                        margin-bottom: 30px;
                    }
                    div{
                        width: 140px;
                        height: 36px;
                        border: 1px solid @primary-color;
                        border-radius: 4px;
                        text-align: center;
                        line-height: 36px;
                        font-size: 14px;
                        color: @primary-color;
                        margin-left: 30px;
                        cursor: pointer;
                    }
                }
                .img{
                    width: 100%;
                    height: 320px;
                    position: relative;
                    .showdiv{
                        position: absolute;
                        top: -146px;
                        left: -90.5px;
                    }
                }
                .name{
                    height: 45px;
                    line-height: 45px;
                    padding: 0 14px;
                    font-size: 16px;
                    color: @font-color;
                    font-weight: bold;
                    span{
                        display: inline-block;
                        width: 150px;
                        overflow: hidden;
                        text-overflow: ellipsis;
                        -ms-text-overflow: ellipsis;
                        -o-text-overflow: ellipsis;
                        white-space: nowrap;
                    }
                    .wsc{
                        float: right;
                        margin-top: 14px;
                        width: 16px;
                        height: 16px;
                        background: url(../../images/collection_before.png) no-repeat;
                        background-size: 100% 100%;
                        cursor: pointer;
                    }
                    .sc{
                        float: right;
                        margin-top: 14px;
                        width: 16px;
                        height: 16px;
                        background: url(../../images/collection_after.png) no-repeat;
                        background-size: 100% 100%;
                        cursor: pointer;
                    }
                   
                }
            }
            .div:hover .ewm{
                display: block;
            }
            .div:hover{
				transition: all 0.1s;
				transform: translateY(-10px);
				box-shadow: 0 10px 40px 0 rgba(255, 211, 214, 0.37), 0 10px 20px 0 rgba(180, 189, 193, 0.65);				
			}
        }
    }
	.homeBottom{
		width: 1200px;
		margin: 0 auto 60px;
        text-align: center;
        display: flex;
        justify-content: center;
		p{
			width: 180px;
			height: 40px;
			line-height: 40px;
			text-align: center;
			font-size: 14px;
			color: @font-color;
			border-radius: 40px;
			margin-left: 510px;
			background-color: @border-color;
			cursor: pointer;
		}
	}
</style>
<style lang="less">
    @border-color:#E3E8EA;//边框颜色
	@font-color:#686E71;//正常字体颜色
	@primary-color:#FE9333;//橘黄色默认颜色
    .templateInfo-list{
        .top{
            position: relative;
           .ivu-input-wrapper{
               width: 230px;
                height: 30px;
                position: absolute;
                top:7px;
                right:10px;
           }
           .ivu-input{
               padding:4px 46px 4px 10px;
           }
        }
    }
</style>
<template>
	<div @click="bodyClick">
        <v-header title="首页"></v-header>
        <div class="templateInfo-top">
            <ul>
                <li class="title">年龄</li>
                <li v-for="(item,ageindex) in ageList" @click="ajaxMore(orderTypeLs,0,item.code,ageindex,jobTypeLs,'',typeLs,'',colorStyleLs,'')" :class=" item.idSelected ? onchoose:on ">{{item.value}}</li>                
            </ul>
            <ul>
                <li class="title">职业</li>
                <li v-for="(item,professionindex) in professionList" @click="ajaxMore(orderTypeLs,0,ageTypeLs,ageindex2,item.code,professionindex,typeLs,'',colorStyleLs,'')" :class=" item.idSelected ? onchoose:on ">{{item.value}}</li>                
            </ul>
            <ul>
                <li class="title">风格</li>
                <li v-for="(item,typeindex) in styleList"   @click="ajaxMore(orderTypeLs,0,ageTypeLs,'',jobTypeLs,'',item.code,typeindex,colorStyleLs,'')" :class=" item.idSelected ? onchoose:on ">{{item.value}}</li>                
            </ul>
            <ul>
                <li class="title">颜色</li>
                <li v-for="(item,colorindex) in colorList" @click="ajaxMore(orderTypeLs,0,ageTypeLs,'',jobTypeLs,'',typeLs,'',item.code,colorindex)" :class=" item.idSelected ? onchoose:on "><span :style="colorStyle(item.code)" class="span"></span>{{item.value}}</li>                
            </ul>
        </div>
        <div class="templateInfo-list">
            <!--头部标签-->
            <div class="top">
                <span :class="onchoosebt" @click="ajaxMore(0,0,ageTypeLs,'',jobTypeLs,'',typeLs,'',colorStyleLs,'')">全部</span>
                <span :class="onchoosebt1" @click="ajaxMore(1,0,ageTypeLs,'',jobTypeLs,'',typeLs,'',colorStyleLs,'')">最新</span>
                <span :class="onchoosebt2" @click="ajaxMore(2,0,ageTypeLs,'',jobTypeLs,'',typeLs,'',colorStyleLs,'')">最热</span>
                <span :class="onchoosebt3" @click="myCollect()">我的收藏</span>
                <div class="search">
                    <Input v-model="value4"  placeholder="请输入关键词" @on-enter="ajaxSerch(value4)" ></Input>
                    <img src="../../images/edit_search.png" @click="ajaxSerch(value4)"/>
                </div>                
            </div>
            <!--内容部分-->
            <div class="not" v-show="notinfo">
                <img src="../../images/noresult.png"/>
                <p>很抱歉，没有找到您需要的信息</p>
            </div>
            <!--模板列表-->
            <div class="list" >
                <!-- 搜索提示语 -->
                <div class="popup" v-if="searchType&&!notinfo">"<span>{{value4}}</span>"，相关模板信息<span>{{templateListTotal}}</span>条</div>
				<div class="popup2" v-else></div>
                <div class="div" v-for="(item,index) in templateList">
                    <!--二维码查看模板-->
                    <div class="ewm">
                        <p>手机扫一扫查看</p>
                        <img :src="hotsimg+'/unsecured/qrcode/image/out?qrcode='+item.qrcode"/>
                        <div @click="creatInfo(item.id)">使用模板</div>
                    </div>
                    <div class="img">
                        <div  style="transform: scale(0.52);" class="showdiv">
                            <div :style="item.templateModule.headerStyle">										<!--头像-->
                                <div :style="item.templateModule.moduleImageDivStyle"><img :src="imgurl+item.templateModule.cemeteryIntroduction.headPictureSource" style="width: 100%;height: 100%;"/></div>
                                    <!--姓名-->
                                    <div :style="item.templateModule.nameStyle" ref="nameStyle">{{item.templateModule.cemeteryIntroduction.userName}}</div>
                                    <!--出生日期-->
                                    <div :style="item.templateModule.introductionDayStyle" ref="introductionStyle">{{birthdayTime(item.templateModule.cemeteryIntroduction.birthDay)+birthDayAnd+birthdayTime(item.templateModule.cemeteryIntroduction.deadDay)}}</div>
                                    <!--个人简介-->
                                    <div :style="item.templateModule.introductionStyle" ref="introductionDayStyle">{{item.templateModule.cemeteryIntroduction.introduction}}</div>			
                                    <v-edittext :textflag="item.templateModule.templateModuleContent"></v-edittext>
                                    <img  :src="imgurl+item1.picSourcePath" v-for="(item1,index) in item.templateModule.templateModulePicDTO" ref="picstyle" :style="item1.picStyle">
                                    <img  :src="imgurl+item1.videoPicSourcePath" v-for="(item1,index) in item.templateModule.templateModuleVideoDTO" ref="spstyle" :style="item1.videoStyle">
                            </div>
                        </div>
                    </div>
                    <div class="name">
                        <span>{{item.templateName}}</span>
                        <div :class=" item.iscollect ? collecton : collect " @click="sc(item.id,item.iscollect,index)"></div>
                    </div>
                </div>               
            </div>
        </div>
        <!--加载更多 和 到底部分-->
		<div class="homeBottom" v-show="templateList.length != 0">
            <Page show-total show-elevator :total="templateListTotal" :page-size="20" @on-change="pageChange" :current="PageNum"></Page>
		</div>
        <v-feedback :backModalType="backModal" @backModalTypeFun="showBackModal"></v-feedback>
        <v-footer></v-footer>
	</div>
</template>
<script>
    import global from '../../config/global'
	import { mapState } from 'vuex'
    export default {
        computed: mapState({ user: state => state.user }),
        data() {
			return {
                imgurl:global.imgurl,
				videourl:global.videourl,
				musicurl:global.musicurl,
				ageList:"",//年龄分类
                professionList:"",//职业分类
                styleList:"",//风格分类
                colorList:"",//颜色分类
                templateList:[],//模板列表
                notinfo:false,//是否有模板数据
                hotsimg:"",//图片前缀
                PageNum:1,//当前页码
                collect:"wsc",//收藏class 名字
                collecton:"sc",//
                collectStatus:"",//收藏状态
                orderTypeLs:"",//列表类型临时存
                ageTypeLs:"",//年龄
                jobTypeLs:"",//职业
                typeLs:"",//风格
                colorStyleLs:"",//颜色
                onchoose:"onchoose",//分类选中样式
                on:"",
                onchoosebt:"onchoosebt",
                onchoosebt1:"",
                onchoosebt2:"",
                onchoosebt3:"",
                ageindex2:0,
                professionindex2:0,
                typeindex2:0,
                colorTypeindex2:0,
                birthDayAnd:"",
                backModal:false,
                templateListTotal:1,//模板列表总条数
                searchType:false,
			}
		},
        created() {
			this.ajax();//分类列表		
		},
        watch:{
        },
		methods:{
           ajax(){
            this.hotsimg = global.host;
            this.$http.get(global.host+'/templateScreeningData/query',{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})              
            .then((response) => {
                this.ageList = response.body.datas.ageCategoryList;
                this.professionList = response.body.datas.jobCategoryList;
                this.styleList = response.body.datas.styleCategoryList;
                this.colorList = response.body.datas.colorCategoryList;     
                this.ajaxMore(0,0,this.ageTypeLs,"",this.jobTypeLs,"",this.typeLs,"",this.colorStyleLs,"");                          
            })
            .catch(function (response) {
                
            })	
            
           },
           ajaxMore(orderType,more,ageType,ageindex,jobType,professionindex,type,typeindex,colorType,colorTypeindex){
                 this.searchType = false; //退出搜索状态
                 this.value4 = '';
                 this.onchoosebt3 = "";
                 if(orderType == 0){
                    this.onchoosebt = "onchoosebt";
                    this.onchoosebt1 = "";
                    this.onchoosebt2 = "";
                 }else if(orderType == 1){
                    this.onchoosebt = "";
                    this.onchoosebt1 = "onchoosebt";
                    this.onchoosebt2 = "";
                 }else if(orderType == 2){
                    this.onchoosebt = "";
                    this.onchoosebt1 = "";
                    this.onchoosebt2 = "onchoosebt";
                 }
                 if(this.ageindex2 != "" || ageindex !="" || ageindex===0 || this.ageindex2===0){   
                     for(var i = 0; i< this.ageList.length; i++ ){
                         this.ageList[i].idSelected = 0;
                     }   
                     if(ageindex != "" || ageindex === 0){
                        this.ageindex2 = ageindex;
                    }                                    
                     this.ageList[this.ageindex2].idSelected = 1; 
                 }else{
                      for(var i = 0; i< this.ageList.length; i++ ){
                         this.ageList[i].idSelected = 0;
                     }
                 }
                 if(this.professionindex2 != "" ||professionindex != "" ||professionindex===0 ||this.professionindex2===0){
                    for(var i = 0; i< this.professionList.length; i++ ){
                         this.professionList[i].idSelected = 0;
                    }
                     if(professionindex != "" || professionindex === 0){
                        this.professionindex2 = professionindex;
                    }  
                      this.professionList[this.professionindex2].idSelected = 1;
                 }else{
                     for(var i = 0; i< this.professionList.length; i++ ){
                         this.professionList[i].idSelected = 0;
                     }
                 }
                 if(this.typeindex2 != "" ||typeindex !="" || typeindex===0||this.typeindex2===0){
                    for(var i = 0; i< this.styleList.length; i++ ){
                         this.styleList[i].idSelected = 0;
                     }
                      if(typeindex != "" || typeindex === 0){
                        this.typeindex2 = typeindex;
                    } 
                      this.styleList[this.typeindex2].idSelected = 1;
                 }else{
                     for(var i = 0; i< this.styleList.length; i++ ){
                         this.styleList[i].idSelected = 0;
                     }
                 }
                 if(this.colorTypeindex2 != "" ||colorTypeindex != "" ||colorTypeindex===0||this.colorTypeindex2===0){
                    for(var i = 0; i< this.colorList.length; i++ ){
                         this.colorList[i].idSelected = 0;
                     }
                      if(colorTypeindex != "" || colorTypeindex === 0){
                        this.colorTypeindex2 = colorTypeindex;
                    } 
                      this.colorList[this.colorTypeindex2].idSelected = 1;
                 }else{
                     for(var i = 0; i< this.colorList.length; i++ ){
                         this.colorList[i].idSelected = 0;
                     }
                 }
                 if(this.orderTypeLs != orderType || this.ageTypeLs !=ageType || this.jobTypeLs !=jobType || this.typeLs != type ||  this.colorStyleLs != colorType){//判断点击最新最热切换 
                     this.PageNum = 1;
                 }
                this.$http.get(global.host+'/cemetery/template/show/query?status='+2+'&startPage='+this.PageNum+'&pageSize='+20+'&orderType='+orderType+'&ageType='+(ageType!=0?ageType:'')+'&jobType='+(jobType!=0?jobType:'')+'&type='+(type!=0?type:'')+'&colorType='+(colorType!=0?colorType:''),{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})                             
                .then((response) => {                 
                    this.templateListTotal = response.body.total;                  
                    if(response.body.total == 0){
                        this.templateList = []; 
                        this.notinfo = true;
                    }else{
                        this.notinfo = false;                                              
                        this.templateList = response.body.result;
                        this.hotsimg = global.host;
                    }
                    // this.ageindex = 
                    this.orderTypeLs = orderType;//最新最热状态临时存
                    this.ageTypeLs = ageType;//年龄分类临时存储
                    this.jobTypeLs = jobType;//职业分类临时存储
                    this.typeLs = type;
                    this.colorStyleLs = colorType;

                })
                .catch(function (response) {
                    
                })	
                
           },
           pageChange(value){
               this.PageNum = value;               
               document.body.scrollTop = 0;
               document.documentElement.scrollTop = 0;
               if(this.onchoosebt3 == 'onchoosebt'){
                   this.myCollect(2);
               }
               if(this.onchoosebt3 != 'onchoosebt' && this.searchType == false){
                   this.ajaxMore(this.orderTypeLs,1,this.ageTypeLs,'',this.jobTypeLs,'',this.typeLs,'',this.colorStyleLs,'');                   
               }
               if(this.searchType == true){
                   this.ajaxSerch(this.value4);
               }
           },
           myCollect(value){//我的收藏
                if(value != 2){
                    this.PageNum = 1;    
                }
                this.searchType = false; //退出搜索状态
                this.value4 = '';                
                this.onchoosebt = "";
                this.onchoosebt1 = "";
                this.onchoosebt2 = "";
                this.onchoosebt3 = "onchoosebt";
                //风格分类全部重置为全部
                for(var i = 0; i< this.ageList.length; i++ ){
                    this.ageList[i].idSelected = 0;
                }  
                this.ageList[0].idSelected = 1
                for(var i = 0; i< this.professionList.length; i++ ){
                    this.professionList[i].idSelected = 0;
                }
                this.professionList[0].idSelected = 1;
                for(var i = 0; i< this.styleList.length; i++ ){
                    this.styleList[i].idSelected = 0;
                }
                this.styleList[0].idSelected = 1;
                for(var i = 0; i< this.colorList.length; i++ ){
                    this.colorList[i].idSelected = 0;
                }
                this.colorList[0].idSelected =1;
                //收藏接口
                this.$http.get(global.host+"/cemetery/template/show/query/collect?startPage="+this.PageNum+"&pageSize=20",{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})//功能列表
                .then((response) => {
                    this.templateListTotal = response.body.total;                  
                    if(response.body.total == 0){
                        this.templateList = []; 
                        this.notinfo = true;
                    }else{
                        this.notinfo = false;                                              
                        this.templateList = response.body.result;
                        this.hotsimg = global.host;
                    }
                })
                .catch(function (response) {
                })
           },
           sc(id,status,index){
               if(status){
                    this.$http.post(global.host+'/cemetery/owner/template/delete',{"templateId":id,"type":1},{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})              
                    .then((response) => {
                        this.templateList[index].iscollect=false;
                    })
                    .catch(function (response) {                   
                    })	
               }else{
                   this.$http.post(global.host+'/cemetery/owner/template/insert',{"templateId":id,"type":1},{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})              
                    .then((response) => {
                        this.templateList[index].iscollect=true;                               

                    })
                    .catch(function (response) {                   
                    })	
               }           
           },
           ajaxSerch(name){
                //进入搜索状态  进入搜索状态  
                if(this.value4 == ''){
                    this.$Message.error('请输入关键词');
                    return ;
                }
                this.onchoosebt = "onchoosebt";
                this.onchoosebt1 = "";
                this.onchoosebt2 = "";
                this.onchoosebt3 = "";
                this.searchType = true; 
                this.$http.get(global.host+'/cemetery/template/show/query?startPage='+this.PageNum+'&pageSize='+20+'&templateName='+(name?name:''),{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})                             
                .then((response) => {
                       this.templateListTotal = response.body.total; 
                       if(response.body.total == 0){
                            this.templateList = []; 
                            this.notinfo = true;
                        }else{
                            this.notinfo = false;                                                                               
                            this.templateList = response.body.result;                           
                            this.hotsimg = global.host;
                        }
                })
                .catch(function (response) {                   
                })	
           },
           creatInfo(id){
                if(this.$route.query.isChoose == undefined){
                    this.$http.post(global.host+"/admin/template/use",{"template":id,"cemeteryId":this.$route.query.s},{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})
                    .then((response) => {
                    
                        this.$router.push({ path: '/templateEdit' ,query:{"nid":response.body.result.templateId,"mid":this.$route.query.s}});//跳转传记页面
                        
                    })
                    .catch(function (response) {
                    })
                }else{
                    this.$http.post(global.host+"/admin/template/update",{"cemeteryId":this.$route.query.s,"newTemplateId":id,"sourceTemplateId":this.$route.query.isChoose},{headers:{"Authorization":this.user.token_type+" "+this.user.access_token}})
                    .then((response) => {
                        this.$router.push({ path: '/templateEdit' ,query:{"nid":this.$route.query.isChoose,"mid":this.$route.query.s}});//跳转传记页面 
                        
                    })
                    .catch(function (response) {
                    })
                }
           },
           colorStyle(code){
             if(code == 1){
                return "background-color:#F1A76F";
             }else if(code == 2){
                return "background-color:#EDCA49";
             }
             else if(code == 3){
                return "background-color:#86AEDF";                
             }
             else if(code == 4){
                return "background-color:#857C7C";                 
             }
             else if(code == 5){
                return "background-color:#fff";              
             }
             else if(code == 6){                 
                return "background-color:#86DFAB";
             }
             else if(code == 7){                
                return "background-color:#BF86DF";
             }
             else if(code == 8){
                return "background-color:#FCC7C7";                 
             }
           },
           birthdayTime(time){
                function add0(m) {
					return m < 10 ? '0' + m : m
				}
				var time = new Date(parseInt(time));
				var y = time.getFullYear();
				var m = time.getMonth() + 1;
				var d = time.getDate();
				if(this.customized == 1){//判断是否需要中文
					y = this.Arabia(y);				
					m = this.Arabia2(m);				
					d = this.Arabia2(d);	
					this.birthDayAnd = " 至 ";
				    return y + '年' + add0(m) + '月' + add0(d) + '日';                    
				}else{
					this.birthDayAnd = " - ";
				    return y + '-' + add0(m) + '-' + add0(d) + '';
                }
            },
            Arabia(Num){
				for (var i = Num.length - 1; i >= 0; i--) {
					Num = Num.replace(",", "")//替换Num中的“,”
					Num = Num.replace(" ", "")//替换Num中的空格
				}    
				//字符处理完毕后开始转换，采用前后两部分分别转换
				var part = String(Num).split(".");
				var newchar = "";
				//小数点前进行转化
				for (i = part[0].length - 1; i >= 0; i--) {
					var tmpnewchar = ""
					var perchar = part[0].charAt(i);
					switch (perchar) {
						case "0":  tmpnewchar = "零" + tmpnewchar;break;
						case "1": tmpnewchar = "一" + tmpnewchar; break;
						case "2": tmpnewchar = "二" + tmpnewchar; break;
						case "3": tmpnewchar = "三" + tmpnewchar; break;
						case "4": tmpnewchar = "四" + tmpnewchar; break;
						case "5": tmpnewchar = "五" + tmpnewchar; break;
						case "6": tmpnewchar = "六" + tmpnewchar; break;
						case "7": tmpnewchar = "七" + tmpnewchar; break;
						case "8": tmpnewchar = "八" + tmpnewchar; break;
						case "9": tmpnewchar = "九" + tmpnewchar; break;
					}
					newchar = tmpnewchar + newchar;
				}   
				return newchar;
			},
			Arabia2(Num){				
				for (var　i = Num.length - 1; i >= 0; i--) {
						Num = Num.replace(",", "")//替换Num中的“,”
						Num = Num.replace(" ", "")//替换Num中的空格
				}    
				//字符处理完毕后开始转换，采用前后两部分分别转换
				var part = String(Num).split(".");
				var newchar = "";
				//小数点前进行转化
				for (var i = part[0].length - 1; i >= 0; i--) {
					var tmpnewchar = ""
					var perchar = part[0].charAt(i);
					switch (perchar) {
						// case "0":  tmpnewchar = "零" + tmpnewchar;break;
						case "1": tmpnewchar = "一" + tmpnewchar; break;
						case "2": tmpnewchar = "二" + tmpnewchar; break;
						case "3": tmpnewchar = "三" + tmpnewchar; break;
						case "4": tmpnewchar = "四" + tmpnewchar; break;
						case "5": tmpnewchar = "五" + tmpnewchar; break;
						case "6": tmpnewchar = "六" + tmpnewchar; break;
						case "7": tmpnewchar = "七" + tmpnewchar; break;
						case "8": tmpnewchar = "八" + tmpnewchar; break;
						case "9": tmpnewchar = "九" + tmpnewchar; break;
					}
					switch (part[0].length - i - 1) {
						case 0: tmpnewchar = tmpnewchar; break;
						case 1: if (perchar != 0) tmpnewchar = tmpnewchar + "十"; break;
						case 2: if (perchar != 0) tmpnewchar = tmpnewchar + "百"; break;
						case 3: if (perchar != 0) tmpnewchar = tmpnewchar + "千"; break;
						case 4: tmpnewchar = tmpnewchar + "万"; break;
						case 5: if (perchar != 0) tmpnewchar = tmpnewchar + "十"; break;
						case 6: if (perchar != 0) tmpnewchar = tmpnewchar + "百"; break;
						case 7: if (perchar != 0) tmpnewchar = tmpnewchar + "千"; break;
						case 8: tmpnewchar = tmpnewchar + "亿"; break;
						case 9: tmpnewchar = tmpnewchar + "十"; break;
					}
					newchar = tmpnewchar + newchar;
				}   
				//替换所有无用汉字，直到没有此类无用的数字为止
				while (newchar.search("零零") != -1 || newchar.search("零亿") != -1 || newchar.search("亿万") != -1 || newchar.search("零万") != -1) {
					newchar = newchar.replace("零亿", "亿");
					newchar = newchar.replace("亿万", "亿");
					newchar = newchar.replace("零万", "万");
					newchar = newchar.replace("零零", "零");      
				}
				//替换以“一十”开头的，为“十”
				if (newchar.indexOf("一十") == 0) {
					newchar = newchar.substr(1);
				}
				//替换以“零”结尾的，为“”
				if (newchar.lastIndexOf("零") == newchar.length - 1) {
					newchar = newchar.substr(0, newchar.length - 1);
				}
				return newchar;
            },
            showBackModal(value){//打开意见反馈弹窗
				this.backModal = value;//根据组件传出的参数来修改传入的值
			},
			bodyClick(){
				this.backModal = false;
			}

		}
    }
</script>